home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Leonardo the Inventor
/
Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso
/
LEOWINMV
/
SHARED.DIR
/
03083_Script_PRINT LEO II A
< prev
next >
Wrap
Text File
|
1996-04-01
|
8KB
|
275 lines
-- --------------------------------------------------------------------------------------
-- Handler doClickPrintButton hilites the print button and then calls the appropriate
-- print handler (depending on the given printType).
on doClickPrintButton printType, source, title, caption
puppetTransition 0
sound stop 1
-- sound stop 2
global printSize
hiliteButton(1,0)
if printingInvention() then
showPrintDialog
if (printSize = "all") then
-- printAllCards
else if (printSize = 0) then
-- they clicked outside the dialog box, cancelling the printing
dontpassevent
exit
end if
else
set printSize = "full"
end if
if (printType = "stage") then
-- print the stage in <printsize>
printScreen(printSize)
else if (printType = "file") then
-- print the file in <printsize>
printFile(printSize, source)
else if (printType = "picture") then
-- print the cast in <printsize>
printPicture(printSize, source, title, caption)
else if (printType = "database") then
-- print the text or picture of the current topic
printDatabase
end if
dontpassevent
end
-- --------------------------------------------------------------------------------------
-- Handler printScreen calls the appropriate print screen handler (depending on the
-- machine type).
on printScreen printSize
if (the machineType = 256) then
-- PC
printScreenPC(printSize)
else
printScreenMAC(printSize)
end if
end
-- --------------------------------------------------------------------------------------
-- Handler printFile
on printFile printSize, fileName
if (the machineType = 256) then
set divider = "\" -- Ephraim. Second time I'm fixing it!!!!
else
set divider = ":"
end if
set fullFileName = the pathName & "PrtPicts" & divider & fileName
if (the machineType = 256) then
-- PC
printFilePC(printSize, fullFileName)
else
printFileMAC(printSize, fullFileName)
end if
end
-- --------------------------------------------------------------------------------------
-- Handler printAllCards
on printAllCards
if (the machineType = 256) then
set divider = "\" -- Ephraim. Second time I'm fixing it!!!!
else
set divider = ":"
end if
set filePathName = the pathName & "PrtPicts" & divider
if (the machineType = 256) then
-- PC
printAllCardsPC(filePathName)
else
printAllCardsMAC(filePathName)
end if
end
-- --------------------------------------------------------------------------------------
-- Handler printPicture
on printPicture printSize, castName, title, caption
if (the machineType = 256) then
-- PC
printPicturePC(printSize, castName, title, caption)
else
printPictureMAC(printSize, castName, title, caption)
end if
end
-- ----------------------------------------------------------------
-- Handler doPrint is called when the user clicks the print button.
-- It prints the a selected frame of the current section. It determines
-- the frame to print by assuming that the current frame is part of a
-- section beginning with a marker. The handler gets the name of the
-- previous marker and using the name, gets the name of the print frame
-- associated with the marker.
on doPrint previousMarker
hiliteButton
set theLabels = the labelList
set numLabels = the number of lines in theLabels
repeat with i = 1 to numLabels
set currentLabel = line i of theLabels
if (label(currentLabel) = previousMarker) then
if (currentLabel = EMPTY) then
-- print the previous printFrame
set currentLabel = line (i-1) of theLabels
exit repeat
else -- currentLabel <> EMPTY
exit repeat
end if
end if
end repeat
set printFrame = currentLabel && "PRT"
set printFrameNumber = label(printFrame)
printFrom printFrameNumber, printFrameNumber
end
-- ----------------------------------------------------------------
-- Handler showPrintDialog is called when the user clicks the print button.
-- It displays a dialogue box that asks the user if he/she wants to
-- print one full-sized screen or four screens.
on showPrintDialog
global dialogSprite
global printDialogLocH, printDialogLocV
-- puppetSprite dialogSprite, TRUE
set the castNum of sprite dialogSprite = the number of cast "print dialog"
set the locH of sprite dialogSprite = printDialogLocH
set the locV of sprite dialogSprite = printDialogLocV
updateStage
choosePrintSize
end
-- ----------------------------------------------------------------
-- Handler choosePrintSize is the cast script of the choose print
-- size dialog box
on choosePrintSize
repeat while not(the mouseDown)
updateStage
end repeat
global dialogSprite, printCardRect, printFullScreenRect, printSize
global printAllCardsRect
-- find out where clicked
set clickPoint = point(the mouseH, the mouseV)
if (inside(clickPoint, printCardRect)) then
set printSize = "card"
else if (inside(clickPoint, printFullScreenRect)) then
set printSize = "full"
-- else if (inside(clickPoint, printAllCardsRect)) then
-- set printSize = "all"
else -- they did not click the dialog box
set printSize = 0
end if
removeFromStage(dialogSprite)
end
-- ----------------------------------------------------------------
-- Handler printDatabase is called when the user clicks the print
-- button in the database.
on printDatabase
if (the machineType = 256) then
-- PC
printDatabasePC
else
printDatabaseMAC
end if
end
-- ----------------------------------------------------------------
-- Handler doPrintFullScreen does the actual printing of the screen.
-- It receives an instance of the printomatic xobj as a parameter
-- (that was created in either printScreenMAC or printScreenPC).
on doPrintFullScreen printObj, fullFileName
-- set up the object:
printobj(mSetDocumentName, "Leonardo 2")
-- 1) reset to page 1
printobj(mreset)
-- 2) set landscape mode
printobj(msetlandscapemode, TRUE)
-- 3) set the margins to as big as possible
set paperwidth = printobj(mgetpaperwidth)
set paperheight = printobj(mgetpaperheight)
printobj(msetmargins, 0, 0, paperwidth, paperheight)
-- 4) set the printable space to the margins
printobj(msetprintablemargins)
set pageH = printobj(mgetpageheight)
set pageW = printobj(mgetpagewidth)
set left = 70
set top = 70
set right = pageW - 35
set bottom = pageH - 35
-- put "pageW" && pageW
-- put "pageH" && pageH
-- put "paperwidth" && paperwidth
-- put "paperheight" && paperheight
-- put "left" && left
-- put "top" && top
-- put "right" && right
-- put "bottom" && bottom
-- 5) start a new page
printobj(mnewpage)
if voidP(fullFileName) then -- printing the screen
-- 6a) page footer left side: copyright notice
printObj(mSetTextSize,10)
printObj(mSetTextStyle,"normal")
printObj (mSetTextJust,"left")
printObj (mDrawText,"⌐1996 SoftKey Multimedia Inc., a subsidiary of SoftKey International Inc.",left,pageH-7)
-- 6b) put a screenShot on the page
printobj(mstagepicture, left, top, right, bottom)
else
-- 6a) put the pict of the file on the page
printObj(mpicture, fullFileName, left, top, right, bottom)
-- currently, all files printed have the copyright already
end if
-- 7) register the xobject
printobj(mRegister, "PMAT130-013-01075")
-- printobj(mprintpreview) -- DEBUG
-- 8) print the page
printobj(mprint)
-- 9) get rid of the object
printobj(mdispose)
end